home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / faq-s.zip / MMOUSE21.PAS < prev    next >
Pascal/Delphi Source File  |  1991-03-09  |  10KB  |  234 lines

  1. { Turbo Mouse Version 2.1 }
  2. { Microsoft Mouse function access routines }
  3. { (C) Copyright 1986,1987 John Vedral.  All Rights Reserved. }
  4.  
  5. { This program is supplied to assist with the development of programs in
  6.   Turbo Pascal using the Microsoft Mouse.  If you find it useful or would
  7.   like to encourage further development of programming tools feel free to
  8.   send a donation ($5 or more is recommended) to :
  9.  
  10.        Vedco Computer
  11.        P.O. Box 236
  12.        Hillsdale, NJ 07642
  13.        (201) 664-2459
  14.  
  15.   This is one way for all of us to fight back at overpriced software. But, if
  16.   you do happen to go commercial with a package that uses these routines feel
  17.   free to send a larger donation and mention us in your documentation. }
  18.  
  19.  
  20.  
  21.  
  22. type cursor_array = array[0..31] of integer;
  23.  
  24. function button_pressed(button : integer) : boolean;
  25.   { returns true if button is down.  Button = 0 for left button and 1 
  26.     for right button } 
  27. Begin
  28.   Inline
  29.     ($B8/$03/$00/         {     MOV AX,3                                      }
  30.      $CD/$33/             {     INT 33H                                       }
  31.      $8B/$4E/$04/         {     MOV CX,[BP+4]                                 }
  32.      $E3/$02/             {     JCXZ B0                                       }
  33.      $D1/$EB/             {     SHR BX,1                                      }
  34.      $89/$5E/$06);        { B0:MOV [BP+6],BX                                  }
  35. End;
  36.  
  37.  
  38. procedure show_cursor; 
  39.   { makes the cursor visible } 
  40. Begin
  41.   Inline
  42.     ($B8/$01/$00/         {     MOV AX,1                                      }
  43.      $CD/$33);            {     INT 33H                                       }
  44. End;
  45.  
  46.  
  47. procedure hide_cursor; 
  48.   { makes cursor invisible } 
  49. Begin
  50.   Inline
  51.     ($B8/$02/$00/         {     MOV AX,2                                      }
  52.      $CD/$33);            {     INT 33H                                       }
  53. End;
  54.  
  55.  
  56. function mouse_installed : boolean; 
  57.   { return true if the mouse driver and hardware are installed.  Also 
  58.     resets mouse to default settings. } 
  59. Begin
  60.   Inline
  61.     ($B8/$00/$00/         {     MOV AX,0                                      }
  62.      $CD/$33/             {     INT 33H                                       }
  63.      $89/$46/$04);        {     MOV [BP+4],AX                                 }
  64. End;
  65.  
  66.  
  67. procedure get_cursor_position (var horizontal, vertical : integer); 
  68.   { get the position of the cursor on the screen }
  69. Begin
  70.   Inline
  71.     ($B8/$03/$00/         {     MOV AX,3                                      }
  72.      $CD/$33/             {     INT 33H                                       }
  73.      $8B/$46/$0A/         {     MOV AX,[BP+10]                                }
  74.      $8E/$C0/             {     MOV ES,AX                                     }
  75.      $8B/$7E/$08/         {     MOV DI,[BP+8]                                 }
  76.      $26/$89/$0D/         {     MOV ES:[DI],CX                                }
  77.      $8B/$46/$06/         {     MOV AX,[BP+6]                                 }
  78.      $8E/$C0/             {     MOV ES,AX                                     }
  79.      $8B/$7E/$04/         {     MOV DI,[BP+4]                                 }
  80.      $26/$89/$15);        {     MOV ES:[DI],DX                                }
  81. End;
  82.  
  83.  
  84. procedure set_cursor_position (horizontal, vertical : integer); 
  85.   { move the cursor to the specified position }
  86. Begin
  87.   Inline
  88.     ($B8/$04/$00/         {     MOV AX,4                                      }
  89.      $8B/$4E/$06/         {     MOV CX,[BP+6]                                 }
  90.      $8B/$56/$04/         {     MOV DX,[BP+4]                                 }
  91.      $CD/$33);            {     INT 33H                                       }
  92. End;
  93.  
  94.  
  95. procedure set_min_max_horiz(minimum, maximum : integer);
  96.   { set the minimum and maximum horizontal position of the cursor }
  97. Begin
  98.   Inline
  99.     ($B8/$07/$00/         {     MOV AX,7                                      }
  100.      $8B/$4E/$06/         {     MOV CX,[BP+6]                                 }
  101.      $8B/$56/$04/         {     MOV DX,[BP+4]                                 }
  102.      $CD/$33);            {     INT 33H                                       }
  103. End;
  104.  
  105.  
  106. procedure set_min_max_vert(minimum, maximum : integer);
  107.   { set the minimum and maximum vertical position of the cursor }
  108. Begin
  109.   Inline
  110.     ($B8/$08/$00/         {     MOV AX,8                                      }
  111.      $8B/$4E/$06/         {     MOV CX,[BP+6]                                 }
  112.      $8B/$56/$04/         {     MOV DX,[BP+4]                                 }
  113.      $CD/$33);            {     INT 33H                                       }
  114. End;
  115.  
  116.  
  117. procedure set_graphics_cursor (hot_spot_x, hot_spot_y : integer; 
  118.                                var cursor : cursor_array); 
  119.   { Pass a custom cursor to the mouse hardware.  Cursor information contained 
  120.     in type cursor_array = array[0..31] of integer.  See examples in Microsoft
  121.     mouse manual.  Concatenate the two arrays shown in the manual into one 
  122.     array. } 
  123. Begin
  124.   Inline
  125.     ($8B/$5E/$0A/         {     MOV BX,[BP+10]                                }
  126.      $8B/$4E/$08/         {     MOV CX,[BP+8]                                 }
  127.      $8B/$56/$04/         {     MOV DX,[BP+4]                                 }
  128.      $8B/$46/$06/         {     MOV AX,[BP+6]                                 }
  129.      $8E/$C0/             {     MOV ES,AX                                     }
  130.      $B8/$09/$00/         {     MOV AX,9                                      }
  131.      $CD/$33);            {     INT 33H                                       }
  132. End;
  133.  
  134.  
  135. procedure read_counters(var horizontal, vertical : integer); 
  136.   { read the the horizontal and vertical mickey count since the last call to 
  137.     this procedure } 
  138. Begin
  139.   Inline
  140.     ($B8/$0B/$00/         {     MOV AX,11                                     }
  141.      $CD/$33/             {     INT 33H                                       }
  142.      $8B/$46/$0A/         {     MOV AX,[BP+10]                                }
  143.      $8E/$C0/             {     MOV ES,AX                                     }
  144.      $8B/$7E/$08/         {     MOV DI,[BP+8]                                 }
  145.      $26/$89/$0D/         {     MOV ES:[DI],CX                                }
  146.      $8B/$46/$06/         {     MOV AX,[BP+6]                                 }
  147.      $8E/$C0/             {     MOV ES,AX                                     }
  148.      $8B/$7E/$04/         {     MOV DI,[BP+4]                                 }
  149.      $26/$89/$15);        {     MOV ES:[DI],DX                                }
  150. End;
  151.  
  152.  
  153. procedure user_subroutine(mask,subroutine_segment,subroutine_offset : integer); 
  154.   { allows a branch to the specified subroutine according to the conditions
  155.     specified in the call mask.  See the Microsoft mouse manual for details } 
  156. Begin
  157.   Inline
  158.     ($8B/$4E/$08/         {     MOV CX,[BP+8]                                 }
  159.      $8B/$46/$06/         {     MOV AX,[BP+6]                                 }
  160.      $8E/$C0/             {     MOV ES,AX                                     }
  161.      $8B/$56/$04/         {     MOV DX,[BP+4]                                 }
  162.      $B8/$0C/$00/         {     MOV AX,12                                     }
  163.      $CD/$33);            {     INT 33H                                       }
  164. End;
  165.  
  166.  
  167. procedure light_pen_on; 
  168.   { enables light pen emulation by the mouse. }
  169. Begin
  170.   Inline
  171.     ($B8/$0D/$00/         {     MOV AX,13                                     }
  172.      $CD/$33);            {     INT 33H                                       }
  173. End;
  174.  
  175.  
  176. procedure light_pen_off; 
  177.   { disables light pen emulation by the mouse. }
  178. Begin
  179.   Inline
  180.     ($B8/$0E/$00/         {     MOV AX,14                                     }
  181.      $CD/$33);            {     INT 33H                                       }
  182. End;
  183.  
  184.  
  185. procedure set_pixel_ratio (horizontal_ratio, vertical_ratio : integer);
  186.   { Sets the sensitivity of the mouse.  The values entered for the ratios 
  187.     determine the number of mickeys per eight pixels.
  188.     for example: horizontal_ratio = 8, vertical_ratio = 16 -> 8 mickeys for 8
  189.     pixels horizontally and 16 mickeys for 8 pixels vertically. } 
  190. Begin
  191.   Inline
  192.     ($B8/$0F/$00/         {     MOV AX,15                                     }
  193.      $8B/$4E/$06/         {     MOV CX,[BP+6]                                 }
  194.      $8B/$56/$04/         {     MOV DX,[BP+4]                                 }
  195.      $CD/$33);            {     INT 33H                                       }
  196. End;
  197.  
  198.  
  199. function number_of_presses (button : integer) : integer; 
  200.   { returns number of times the button has been pressed since the last call 
  201.     to this function.  Button = 0 for left button and 1 for right button } 
  202. Begin
  203.   Inline
  204.     ($B8/$05/$00/         {     MOV AX,5                                      }
  205.      $8B/$5E/$04/         {     MOV BX,[BP+4]                                 }
  206.      $CD/$33/             {     INT 33H                                       }
  207.      $89/$5E/$06);        {     MOV [BP+6],BX                                 }
  208. End;
  209.  
  210.  
  211. function number_of_releases (button : integer) : integer; 
  212.   { returns number of times the button has been released since the last call 
  213.     to this function.  Button = 0 for left button and 1 for right button } 
  214. Begin
  215.   Inline
  216.     ($B8/$06/$00/         {     MOV AX,6                                      }
  217.      $8B/$5E/$04/         {     MOV BX,[BP+4]                                 }
  218.      $CD/$33/             {     INT 33H                                       }
  219.      $89/$5E/$06);        {     MOV [BP+6],BX                                 }
  220. End;
  221.  
  222.  
  223. procedure set_text_cursor (bottom_line, top_line : integer); 
  224.   { select the text cursor and the scan lines used.  On the CGA the cursor 
  225.     can be up to 8 scan lines high, numbered 0-7.  On the MDA, 0-11. } 
  226. Begin
  227.   Inline
  228.     ($B8/$0A/$00/         {     MOV AX,10                                     }
  229.      $BB/$01/$00/         {     MOV BX,1                                      }
  230.      $8B/$4E/$06/         {     MOV CX,[BP+6]                                 }
  231.      $8B/$56/$04/         {     MOV DX,[BP+4]                                 }
  232.      $CD/$33);            {     INT 33H                                       }
  233. End;
  234.